package com.bdth.bdthmall.api.epoint.controller;

import com.alibaba.fastjson.JSONObject;
import com.bdth.bdthmall.api.annotation.AuthToken;
import com.bdth.bdthmall.api.epoint.vo.ProductCategoryVo;
import com.bdth.bdthmall.api.epoint.vo.ResponseCategoryVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2020/1/13.
 */
@RestController
@RequestMapping("/ecservice")
public class ProductCategoryController {
    @RequestMapping(value = "/getProductCategory", method = RequestMethod.POST)
    @AuthToken
    public ResponseCategoryVo getProductCategory(@RequestParam String data){
        JSONObject json = JSONObject.parseObject(data);
        List<ProductCategoryVo> list = new ArrayList<>();
        ProductCategoryVo item1 = new ProductCategoryVo();
        item1.setCategoryId("A02010103");
        item1.setName("服务器");
        ProductCategoryVo item2 = new ProductCategoryVo();
        item2.setCategoryId("A02010104");
        item2.setName("台式计算机（含一体机台式电脑）");
        ProductCategoryVo item3 = new ProductCategoryVo();
        item3.setCategoryId("A02010103");
        item3.setName("便携式计算机");
        list.add(item1);
        list.add(item2);
        list.add(item3);
        return ResponseCategoryVo.builder().success(true).msg("返回商品列表成功").result(list);
    }
}
